package com.n9.qq.android.login.tlv;

import java.nio.ByteBuffer;
import java.util.List;

/**
 * @author ice
 * @since 2019/2/12 14:18
 */
public class Tlv0511 extends BaseTlv {

    public Tlv0511() {
        this.cmd = 0x0511;
    }


    public byte[] getData(List<String> strings) {
        ByteBuffer buf = ByteBuffer.allocate(1024);
        buf.putShort((short)strings.size());
        strings.forEach(string ->{
            buf.put((byte)1);
            byte[] bytes = string.getBytes();
            buf.putShort((short)bytes.length);
            buf.put(bytes);
        });

        buf.flip();
        byte[] data = new byte[buf.remaining()];
        buf.get(data);
        return getBufData(data);
    }

}
